package 水果大礼包;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long m = in.nextLong();
        long a = in.nextLong();
        long b = in.nextLong();
        long res = 0;
        for (long x = 0; x <= Math.min(n / 2, m); x++) {
            long y = Math.min(n - x * 2, (m - x) / 2);
            res = Math.max(res, a * x + b * y);
        }
        System.out.println(res);
    }
}
